home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / progs / thor / fse / figlet.fse < prev    next >
Text File  |  1996-11-10  |  2KB  |  76 lines

  1. /* Figlet.fse by Troels Walsted Hansen
  2. ** $VER: Figlet.fse v1.00 (21.11.94)
  3. **
  4. ** An ARexx script that asks you for a string and a figlet font,
  5. ** and then, using the figlet program, writes whatever string you
  6. ** entered, in the font you chose, into the editor.
  7. */
  8.  
  9. /* some user variables. edit to your hearts content */
  10.  
  11. figletprogpath = "Work:Figlet/"
  12. figletfontpath = "Work:Figlet/"
  13.  
  14. /* needs FSE and THOR functions */
  15.  
  16. options results
  17.  
  18. if(substr(address(),1,8) ~= "THOR_FSE") then
  19. do
  20.     say "This script should only be started from inside the FSE."
  21.     exit 20
  22. end
  23. else fseport = address()
  24.  
  25. p = ' ' || address() || ' ' || show('P',,)
  26. thorport = pos(' THOR.',p)
  27.  
  28. if thorport > 0 then thorport = word(substr(p,thorport+1),1)
  29. else
  30. do
  31.     say 'No THOR port found!'
  32.     exit 10
  33. end
  34.  
  35. /* get string */
  36.  
  37. address(fseport)
  38. REQUESTSTRING TITLE '"Enter some text:"' BT '"_Ok|_Cancel"' MAXCHARS 999
  39. if(rc ~= 0) then exit
  40.  
  41. figletstring = result
  42.  
  43. /* get fontname */
  44.  
  45. address(thorport)
  46. THORTOFRONT
  47.  
  48. REQUESTFILE TITLE '"Select figlet font:"' ID '"'figletfontpath'"' FP PAT '"#?.flf"'
  49. if(rc ~= 0) then exit
  50.  
  51. figletfont = result
  52. lastchar = right(figletfont,3)
  53.  
  54. if(lastchar ~= "flf" | figletfont = "") then exit
  55.  
  56. /* run figlet */
  57.  
  58. call open(ofh, "T:figlet.fse.temp.file1", W)
  59.     call writeln(ofh, figletstring)
  60. call close(ofh)
  61.  
  62. address(fseport)
  63. LINELENGTH
  64. columnsnumber = result
  65.  
  66. address command figletprogpath || 'figlet <T:figlet.fse.temp.file1 >T:figlet.fse.temp.file2 ' || delstr(figletfont, lastpos(".",figletfont)) || ' center columns ' || columnsnumber
  67.  
  68. address(fseport)
  69. INCLUDEFILE "T:figlet.fse.temp.file2"
  70.  
  71. /* cleanup and exit */
  72.  
  73. if(exists("T:figlet.fse.temp.file1")) then address command 'delete >nil: "T:figlet.fse.temp.file1"'
  74. if(exists("T:figlet.fse.temp.file2")) then address command 'delete >nil: "T:figlet.fse.temp.file2"'
  75. exit
  76.